﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace XNAGuiLib.Core
{
    public class Component
    {

        /// <summary>
        /// protected field of Component for visibility
        /// </summary>
        protected bool _visible = true;

        /// <summary>
        /// protected field of Component for enabling
        /// </summary>
        protected bool _enabled = true;

        // relative position to the owners position
        #region Public Field - RelativePosition
        protected Vector2 _relativePosition = new Vector2(0, 0);
        /// <summary>
        /// gets or sets the relative to owner position of this Component
        /// </summary>
        public Vector2 RelativePosition
        {
            get
            {
                return _relativePosition;
            }
            set
            {
                _relativePosition = value;
            }
        }
        #endregion

        // total position from the origin
        #region Public Field - TotalPosition
        /// <summary>
        /// gets the total position of the Component
        /// </summary>
        public Vector2 TotalPosition
        {
            get
            {
                if (_owner != null)
                    return _owner.TotalPosition + _relativePosition;
                else return _relativePosition;
            }
        }
        #endregion

        // owner of this Component
        #region Public Field - Owner
        protected Component _owner = null;
        /// <summary>
        /// gets or sets the Component owner of this Component
        /// </summary>
        public Component Owner
        {
            get
            {
                return _owner;
            }
            set
            {
                _owner = value;
            }
        }
        #endregion


        public virtual void Draw(SpriteBatch spriteBatch)
        {

        }
    }
}
